<%--
  Created by IntelliJ IDEA.
  User: 殇
  Date: 2021/1/20
  Time: 11:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>
        管理员管理
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <script type="text/javascript" src="lib/loading/okLoading.js"></script>
    <link rel="stylesheet" href="css/main.css" media="all">
</head>
<style>
    .imgs{display: none;}
    .picture{display: none;}
</style>
<body>
<div class="x-body" style=";position: absolute;top: 30%;left: 40%;">
    <div class="x-body">
        <form class="layui-form" id="adminadd">
            <input type="hidden" name="id" value="">
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    调拨单号 <span class="x-red">*</span>
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="name" name="name" required="" lay-verify="required"
                           placeholder="请输入单号"    autocomplete="off" class="layui-input" value="">
                </div>
            </div>


            <div class="layui-form-item">
                <label for="role" class="layui-form-label">
                    原仓库<span class="x-red">*</span>
                </label>
                <div class="layui-input-inline">
                    <select name="group_id">
                        <option value="">请选择角色</option>
                        <option value="1" >超级管理员</option>

                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="role" class="layui-form-label">
                    目标仓库<span class="x-red">*</span>
                </label>
                <div class="layui-input-inline">
                    <select name="group_id">
                        <option value="">请选择角色</option>
                        <option value="1" >超级管理员</option>

                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    备注<span class="x-red">*</span>
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="name" name="name" required="" lay-verify="required"
                           placeholder="请输入备注"    autocomplete="off" class="layui-input" value="">
                </div>

            </div>
            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <br/>
                <br/>

                &emsp;&emsp;&emsp;&emsp;
                <button class="layui-btn" onclick="mailbox_add('添加','mailboxadd.html','1000','600')">
                    <i class="layui-icon">&#xe608;</i>调拨
                </button>
                <button class="layui-btn layui-btn-danger" onclick="delAll()">
                    <i class="layui-icon">&#xe640;</i>重置
                </button>
            </div>
        </form>
    </div>
</div>
<script src="lib/layui/layui.js" charset="utf-8">
</script>
<script src="js/x-layui.js" charset="utf-8">
</script>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form()
            ,layer = layui.layer;
        okLoading.close($);
        //自定义验证规则
        /*form.verify({
          nikename: function(value){
            if(value.length < 5){
              return '昵称至少得5个字符啊';
            }
          }
          ,pass: [/(.+){6,12}$/, '密码必须6到12位']
          ,repass: function(value){
              if($('#L_pass').val()!=$('#L_repass').val()){
                  return '两次密码不一致';
              }
          }
        });*/

        //监听提交
        form.on('submit(add)', function(data){
            var admindate=$("#adminadd").serialize();
            //var data = data.field;
            $.ajax({
                type:'post',
                url:"xxx",
                data:admindate,
                datatype:"json",
                success:function (data) {
                    if(data.status==1){
                        layer.msg(data.info,{icon:1,time:1000});
                        setTimeout(function(){
                            window.parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        },1000);
                        return false;
                    }else{
                        layer.msg(data.info,{icon:5,time:2000});return false;
                    }
                }
            })
            return false;
        });


    });
</script>
<script>
    //轮播图上传
    function upload(obj,id)
    {
        var formData = new FormData();
        formData.append('img', $('#previewImg')[0].files[0]);
        formData.append('id', id);//将id追加再id中
        layer.msg('图片上传中', {icon: 16});
        $.ajax({
            type:"post",
            processData: false,
            contentType: false,
            url:"xxx",
            data:formData,
            success:function(data){
                if(data.status == 1){
                    //console.log(data.image_name);
                    layer.closeAll('loading');
                    //layer.msg(data.info,{icon:1,time:1000});
                    $("#pimages").attr('src',data.image_name);
                    $("#avatar").val(data.image_name);
                    $(".imgs").show();
                    return false;
                }else{
                    layer.msg(data.info,{icon:2,time:1000});
                }
            }
        });
    }
</script>

</body>

</html>
